package com.rp.configure.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rp.common.result.ResultDTO;
import com.rp.common.utils.NullIs;
import com.rp.configure.entity.Alarm;
import com.rp.configure.entity.OperationLog;
import com.rp.configure.service.OperationLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author vicente
 * @since 2021-07-19
 */
@RestController
@RequestMapping("/operation-log")
@Api("操作日志")
public class OperationLogController {
    @Autowired
    OperationLogService operationLogService;

    @GetMapping("/list_page")
    @ApiOperation(value = "Alarm更据用户id查询所有报警信息")
    public ResultDTO<List<OperationLog>> listPage(
            @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
            @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
            @RequestParam(value = "userId") String userId,
            @RequestParam(value = "gatewayId",required = false) String gatewayId,
            @RequestParam(value = "subjectId",required = false) String subjectId) {
            IPage<OperationLog> list = operationLogService.listPage(new Page<>(pageNum, pageSize),userId,gatewayId,subjectId);
            return ResultDTO.success().data(list);
    }

}
